package cn.gzjp.modules.logis.entity;

import cn.gzjp.common.config.Global;
import cn.hutool.core.util.StrUtil;
import org.hibernate.validator.constraints.Length;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

import java.util.Arrays;
import java.util.List;

/**
 * 货运保险Entity
 * @author zengcp
 * @version 2018-04-28
 */
public class LogisInsurePhoto extends DataEntity<LogisInsurePhoto> {
	
	private static final long serialVersionUID = 1L;
	private String openid;		// openid
	private String deliveryId;		// delivery_id
	private String pic1;		// pic1
	private String pic2;		// pic2
	private String pic3;		// pic3
	private String pic4;		// pic4
	private String pic5;		// pic5
	private String pic6;		// pic6
	private String pic7;		// pic7
	private String pic8;		// pic8

	private String carHeadPic;//车头照片
	private String carTailPic;//车尾照片
	private String weightPic;//过磅照片
	private String morePics;//更多细节

	private String status;		// 0待审核 1通过 2驳回

	private String status1;//1.货物单信息 审核状态
	private String status2;//2.受益人信息 审核状态
	private String status3;//3.货物装车照片 审核状态
	private String status4;//4.货车手续  审核状态
	private String status5;//5.发货单 审核结果
	private String refusereason1;// 货物 审核驳回原因
	private String refusereason2;// 受益人 审核驳回原因
	private String refusereason3;// 货物装车照片 审核驳回原因
	private String refusereason4;// 货车手续  审核驳回原因
	private String refusereason5;// 发货单 审核驳回原因
	private String refusereason;// 审核驳回原因

	private String goodsName;		// 货物名称
	private String startAddress;		// 始发地
	private String endAddress;		// 目的地
	private String licensePlate;		// 车牌
	private String driverName;		// 司机姓名
	private String receiverName;		// 收货人名称
	private String receiverMobile;		// 收货人手机号

	private String policy;		// 保单

	private String policyUrl; //保单访问地址



	private int hwbx;//货物保险费(数字),不投保传0
	private String hwbxText;////货物保险(文字描述)

	private String policyId;		// 保单号
	private String beneficiary;//受益人姓名
	private String beneficiaryGender;//受益人性别
	private String beneficiaryIdCard;//受益人身份证
	private String beneficiaryMobile;//收益人手机号

	private String policyDate;//投保时间(支付订金时间)
	private String policyStartDate;//保单生效时间(支付订单后第2天)
	private String policyEndDate; //保单到期( 支付订金后9天)

	private boolean  beneficiaryFinish;//受益人信息完整  true/false;


	private String idcardImg1;//身份证正面
	private String idcardImg2;//反面


	public boolean isBeneficiaryFinish() {
		return beneficiaryFinish;
	}

	public void setBeneficiaryFinish(boolean beneficiaryFinish) {
		this.beneficiaryFinish = beneficiaryFinish;
	}

	public LogisInsurePhoto() {
		super();
	}

	public LogisInsurePhoto(String id){
		super(id);
	}

	@Length(min=0, max=32, message="openid长度必须介于 0 和 32 之间")
	@ExcelField(title="openid", align=2, sort=1)
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	@Length(min=0, max=32, message="delivery_id长度必须介于 0 和 32 之间")
	@ExcelField(title="delivery_id", align=2, sort=2)
	public String getDeliveryId() {
		return deliveryId;
	}

	public void setDeliveryId(String deliveryId) {
		this.deliveryId = deliveryId;
	}
	
	@Length(min=0, max=256, message="pic1长度必须介于 0 和 256 之间")
	@ExcelField(title="pic1", align=2, sort=3)
	public String getPic1() {
		return pic1;
	}

	public void setPic1(String pic1) {
		this.pic1 = pic1;
	}
	
	@Length(min=0, max=256, message="pic2长度必须介于 0 和 256 之间")
	@ExcelField(title="pic2", align=2, sort=4)
	public String getPic2() {
		return pic2;
	}

	public void setPic2(String pic2) {
		this.pic2 = pic2;
	}
	
	@Length(min=0, max=256, message="pic3长度必须介于 0 和 256 之间")
	@ExcelField(title="pic3", align=2, sort=5)
	public String getPic3() {
		return pic3;
	}

	public void setPic3(String pic3) {
		this.pic3 = pic3;
	}
	
	@Length(min=0, max=256, message="pic4长度必须介于 0 和 256 之间")
	@ExcelField(title="pic4", align=2, sort=6)
	public String getPic4() {
		return pic4;
	}

	public void setPic4(String pic4) {
		this.pic4 = pic4;
	}
	
	@Length(min=0, max=256, message="pic5长度必须介于 0 和 256 之间")
	@ExcelField(title="pic5", align=2, sort=7)
	public String getPic5() {
		return pic5;
	}

	public void setPic5(String pic5) {
		this.pic5 = pic5;
	}
	
	@Length(min=0, max=256, message="pic6长度必须介于 0 和 256 之间")
	@ExcelField(title="pic6", align=2, sort=8)
	public String getPic6() {
		return pic6;
	}

	public void setPic6(String pic6) {
		this.pic6 = pic6;
	}
	
	@Length(min=0, max=11, message="0审核中 1已认证 2请重新上传长度必须介于 0 和 11 之间")
	@ExcelField(title="0审核中 1已认证 2请重新上传", dictType="logis_car_status", align=2, sort=10)
	public String getStatus() {
		if("1".equals(this.getStatus1())&&"1".equals(this.getStatus2())&&"1".equals(this.getStatus4())){
			return "1";
		}
		if("0".equals(this.getStatus1())&&"0".equals(this.getStatus2())&&"0".equals(this.getStatus4())){
			return "0";
		}
		return "2";
	}

//	public String getStatus() {
//		if("1".equals(this.getStatus1())&&"1".equals(this.getStatus2())&&"1".equals(this.getStatus3())&&"1".equals(this.getStatus4())&&"1".equals(this.getStatus5())){
//			return "1";
//		}
//		if("0".equals(this.getStatus1())&&"0".equals(this.getStatus2())&&"0".equals(this.getStatus3())&&"0".equals(this.getStatus4())&&"0".equals(this.getStatus5())){
//			return "0";
//		}
//		return "2";
//	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	@Length(min=0, max=32, message="货物名称长度必须介于 0 和 32 之间")
	@ExcelField(title="货物名称", align=2, sort=11)
	public String getGoodsName() {
		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}
	
	@Length(min=0, max=32, message="始发地长度必须介于 0 和 32 之间")
	@ExcelField(title="始发地", align=2, sort=12)
	public String getStartAddress() {
		return startAddress;
	}

	public void setStartAddress(String startAddress) {
		this.startAddress = startAddress;
	}
	
	@Length(min=0, max=32, message="目的地长度必须介于 0 和 32 之间")
	@ExcelField(title="目的地", align=2, sort=13)
	public String getEndAddress() {
		return endAddress;
	}

	public void setEndAddress(String endAddress) {
		this.endAddress = endAddress;
	}
	
	@Length(min=0, max=32, message="车牌长度必须介于 0 和 32 之间")
	@ExcelField(title="车牌", align=2, sort=14)
	public String getLicensePlate() {
		return licensePlate;
	}

	public void setLicensePlate(String licensePlate) {
		this.licensePlate = licensePlate;
	}
	
	@Length(min=0, max=32, message="司机姓名长度必须介于 0 和 32 之间")
	@ExcelField(title="司机姓名", align=2, sort=15)
	public String getDriverName() {
		return driverName;
	}

	public void setDriverName(String driverName) {
		this.driverName = driverName;
	}
	
	@Length(min=0, max=32, message="收货人名称长度必须介于 0 和 32 之间")
	@ExcelField(title="收货人名称", align=2, sort=16)
	public String getReceiverName() {
		return receiverName;
	}

	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}
	
	@Length(min=0, max=32, message="收货人手机号长度必须介于 0 和 32 之间")
	@ExcelField(title="收货人手机号", align=2, sort=17)
	public String getReceiverMobile() {
		return receiverMobile;
	}

	public void setReceiverMobile(String receiverMobile) {
		this.receiverMobile = receiverMobile;
	}
	
	@Length(min=0, max=256, message="pic7长度必须介于 0 和 256 之间")
	@ExcelField(title="pic7", align=2, sort=18)
	public String getPic7() {
		return pic7;
	}

	public void setPic7(String pic7) {
		this.pic7 = pic7;
	}
	
	@Length(min=0, max=256, message="pic8长度必须介于 0 和 256 之间")
	@ExcelField(title="pic8", align=2, sort=19)
	public String getPic8() {
		return pic8;
	}

	public void setPic8(String pic8) {
		this.pic8 = pic8;
	}
	
	@Length(min=0, max=256, message="保单长度必须介于 0 和 256 之间")
	@ExcelField(title="保单", align=2, sort=20)
	public String getPolicy() {
		return policy;
	}

	public void setPolicy(String policy) {
		this.policy = policy;
	}
	
	@Length(min=0, max=32, message="保单号长度必须介于 0 和 32 之间")
	@ExcelField(title="保单号", align=2, sort=21)
	public String getPolicyId() {
		return policyId;
	}

	public void setPolicyId(String policyId) {
		this.policyId = policyId;
	}
	
	@Length(min=0, max=64, message="拒绝原因长度必须介于 0 和 64 之间")
	@ExcelField(title="拒绝原因", align=2, sort=22)
	public String getRefusereason() {
		return refusereason;
	}

	public void setRefusereason(String refusereason) {
		this.refusereason = refusereason;
	}

	public int getHwbx() {
		return hwbx;
	}

	public void setHwbx(int hwbx) {
		this.hwbx = hwbx;
	}

	public String getHwbxText() {
		return hwbxText;
	}

	public void setHwbxText(String hwbxText) {
		this.hwbxText = hwbxText;
	}

	public String getBeneficiary() {
		return beneficiary;
	}

	public void setBeneficiary(String beneficiary) {
		this.beneficiary = beneficiary;
	}

	public String getBeneficiaryGender() {
		return beneficiaryGender;
	}

	public void setBeneficiaryGender(String beneficiaryGender) {
		this.beneficiaryGender = beneficiaryGender;
	}

	public String getBeneficiaryIdCard() {
		return beneficiaryIdCard;
	}

	public void setBeneficiaryIdCard(String beneficiaryIdCard) {
		this.beneficiaryIdCard = beneficiaryIdCard;
	}

	public String getBeneficiaryMobile() {
		return beneficiaryMobile;
	}

	public void setBeneficiaryMobile(String beneficiaryMobile) {
		this.beneficiaryMobile = beneficiaryMobile;
	}

	public String getPolicyDate() {
		return policyDate;
	}

	public void setPolicyDate(String policyDate) {
		this.policyDate = policyDate;
	}

	public String getPolicyStartDate() {
		return policyStartDate;
	}

	public void setPolicyStartDate(String policyStartDate) {
		this.policyStartDate = policyStartDate;
	}

	public String getPolicyEndDate() {
		return policyEndDate;
	}

	public void setPolicyEndDate(String policyEndDate) {
		this.policyEndDate = policyEndDate;
	}

	public List<String> getPics() {
		if(StrUtil.isNotBlank(this.getPic8())){
			String[] pics = this.getPic8().split("\\|");
			return Arrays.asList(pics);
		}
		return null;
	}

	public String getMorePics() {
		return morePics;
	}

	public void setMorePics(String morePics) {
		this.morePics = morePics;
	}

	public List<String> getMorePicList() {
		if(StrUtil.isNotBlank(this.getMorePics())){
			String[] pics = this.getMorePics().split("\\|");
			return Arrays.asList(pics);
		}
		return null;
	}


	public String getStatus1() {
		return status1;
	}

	public void setStatus1(String status1) {
		this.status1 = status1;
	}

	public String getStatus2() {
		return status2;
	}

	public void setStatus2(String status2) {
		this.status2 = status2;
	}

	public String getStatus3() {
		return status3;
	}

	public void setStatus3(String status3) {
		this.status3 = status3;
	}

	public String getStatus4() {
		return status4;
	}

	public void setStatus4(String status4) {
		this.status4 = status4;
	}

	public String getStatus5() {
		return status5;
	}

	public void setStatus5(String status5) {
		this.status5 = status5;
	}

	public String getRefusereason1() {
		return refusereason1;
	}

	public void setRefusereason1(String refusereason1) {
		this.refusereason1 = refusereason1;
	}

	public String getRefusereason2() {
		return refusereason2;
	}

	public void setRefusereason2(String refusereason2) {
		this.refusereason2 = refusereason2;
	}

	public String getRefusereason3() {
		return refusereason3;
	}

	public void setRefusereason3(String refusereason3) {
		this.refusereason3 = refusereason3;
	}

	public String getRefusereason4() {
		return refusereason4;
	}

	public void setRefusereason4(String refusereason4) {
		this.refusereason4 = refusereason4;
	}

	public String getRefusereason5() {
		return refusereason5;
	}

	public void setRefusereason5(String refusereason5) {
		this.refusereason5 = refusereason5;
	}

	public String getCarHeadPic() {
		return carHeadPic;
	}

	public void setCarHeadPic(String carHeadPic) {
		this.carHeadPic = carHeadPic;
	}

	public String getWeightPic() {
		return weightPic;
	}

	public void setWeightPic(String weightPic) {
		this.weightPic = weightPic;
	}

	public String getCarTailPic() {
		return carTailPic;
	}

	public void setCarTailPic(String carTailPic) {
		this.carTailPic = carTailPic;
	}

	public String getIdcardImg1() {
		return idcardImg1;
	}

	public void setIdcardImg1(String idcardImg1) {
		this.idcardImg1 = idcardImg1;
	}

	public String getIdcardImg2() {
		return idcardImg2;
	}

	public void setIdcardImg2(String idcardImg2) {
		this.idcardImg2 = idcardImg2;
	}

	public String getPolicyUrl() {
		if(StrUtil.isNotBlank(this.getPolicy())){
			return Global.getConfig("photoUrl")+this.getPolicy();
		}
		return policyUrl;
	}

	public void setPolicyUrl(String policyUrl) {
		this.policyUrl = policyUrl;
	}
}